home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / f90 / unpack.z / unpack
Encoding:
Text File  |  1998-10-30  |  2.7 KB  |  86 lines

  1. UNPACK(3I)                                             Last changed: 1-6-98
  2.  
  3.  
  4. NNAAMMEE
  5.      UUNNPPAACCKK - Unpacks an array of rank one into an array under control of a
  6.      mask
  7.  
  8. SSYYNNOOPPSSIISS
  9.      UUNNPPAACCKK (([VVEECCTTOORR==]_v_e_c_t_o_r,, [MMAASSKK==]_m_a_s_k,, [FFIIEELLDD==]_f_i_e_l_d))
  10.  
  11. IIMMPPLLEEMMEENNTTAATTIIOONN
  12.      UNICOS, UNICOS/mk, and IRIX systems
  13.  
  14. SSTTAANNDDAARRDDSS
  15.      Fortran 90
  16.  
  17. DDEESSCCRRIIPPTTIIOONN
  18.      The UUNNPPAACCKK intrinsic function unpacks an array of rank one into an
  19.      array under control of _m_a_s_k.  It accepts the following arguments:
  20.  
  21.      _v_e_c_t_o_r    Can be of any type.  It must have rank one.  Its size must
  22.                be at least _t where _t is the number of true elements in
  23.                _m_a_s_k.
  24.  
  25.      _m_a_s_k      Must be of type logical and array valued.
  26.  
  27.      _f_i_e_l_d     Must be of the same type as _v_e_c_t_o_r, and must be conformable
  28.                with _m_a_s_k.
  29.  
  30.      UUNNPPAACCKK is a transformational function.  The name of this intrinsic
  31.      cannot be passed as an argument.
  32.  
  33. RREETTUURRNN VVAALLUUEESS
  34.      The result is an array of the same type as _v_e_c_t_o_r and the same shape
  35.      as _m_a_s_k.
  36.  
  37.      The element of the result that corresponds to the _ith true element of
  38.      _m_a_s_k, in array element order, has the value _v_e_c_t_o_r(_i) for _i=1, 2, ...,
  39.      _t where _t is the number of true values in _m_a_s_k.  Each other element
  40.      has the value equal to _f_i_e_l_d if _f_i_e_l_d is scalar or to the
  41.      corresponding element of _f_i_e_l_d if it is an array.
  42.  
  43. EEXXAAMMPPLLEESS
  44.      This example uses UUNNPPAACCKK to scatter specific values to specific
  45.      positions in an array.
  46.  
  47.      Assume that MM is the following array:
  48.  
  49.         | 1 0 0 |
  50.  
  51.         | 0 1 0 |
  52.  
  53.         | 0 0 1 |
  54.  
  55.      Assume that VV is the array [1, 2, 3].
  56.  
  57.      Assume that QQ is the logical mask:
  58.  
  59.         | F T F |
  60.  
  61.         | T F F |
  62.  
  63.         | F F T |
  64.  
  65.      In logical mask QQ, TT represents true and FF represents false, so
  66.      UUNNPPAACCKK((VV,, MMAASSKK==QQ,, FFIIEELLDD==MM)) has the following value:
  67.  
  68.         | 1 2 0 |
  69.  
  70.         | 1 1 0 |
  71.  
  72.         | 0 0 3 |
  73.  
  74.      The result of UUNNPPAACCKK((VV,, MMAASSKK==QQ,, FFIIEELLDD==00)) has the following value:
  75.  
  76.         | 0 2 0 |
  77.  
  78.         | 1 0 0 |
  79.  
  80.         | 0 0 3 |
  81.  
  82. SSEEEE AALLSSOO
  83.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-2138, for the
  84.      printed version of this man page.
  85.  
  86.